package tt.dz.service.imp.sys;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tt.dz.dao.ext.charger.OmsChargerBespeakBillRecordDao;
import tt.dz.dao.ext.charger.OmsChargerChargeBillRecordDao;
import tt.dz.entity.base.JsonForList;
import tt.dz.entity.charger.OmsChargerBespeakBillRecord;
import tt.dz.entity.charger.OmsChargerChargeBillRecord;
import tt.dz.service.sys.BillService;
@Service @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class BillServiceImpl  implements BillService{
	@Resource
	OmsChargerChargeBillRecordDao omsChargerChargeBillRecordDao;
	@Resource
	OmsChargerBespeakBillRecordDao omsChargerBespeakBillRecordDao;

	@Override
	public OmsChargerChargeBillRecord findOneChargeBillExample(OmsChargerChargeBillRecord obj,
			String order, String sortVal) {
		return omsChargerChargeBillRecordDao.findOneExample(obj, order, sortVal);
	}
	@Override
	public int updateChargeBill(OmsChargerChargeBillRecord billRecord) {
		return omsChargerChargeBillRecordDao.updateObject(billRecord);
	}
	@Override
	public int saveBespeakBill(OmsChargerBespeakBillRecord billRecord) {
		return omsChargerBespeakBillRecordDao.save(billRecord);
	}
	@Override
	public OmsChargerBespeakBillRecord findBespeakBillOneExampleByCondition(
			OmsChargerBespeakBillRecord obj, String condition) {
		return omsChargerBespeakBillRecordDao.findOneExampleByCondition(obj, condition);
	}
	@Override
	public OmsChargerBespeakBillRecord findBespeakBillOneExample(OmsChargerBespeakBillRecord obj,
			String order, String sortVal) {
		return omsChargerBespeakBillRecordDao.findOneExample(obj, order, sortVal);
	}
	@Override
	public int saveChargeBill(OmsChargerChargeBillRecord billRecord) {
		return omsChargerChargeBillRecordDao.save(billRecord);
	}
	
	@Override
	public List<OmsChargerBespeakBillRecord> findBespeakBills(OmsChargerBespeakBillRecord queryObj,int pageNo){
		return this.omsChargerBespeakBillRecordDao.findListByPageAndGroupAndOrderAndCondition(queryObj, "  WHERE user_pay_card = '" + queryObj.getUser_pay_card() + "'  ", pageNo, null, null, null,null);
	}
	
	@Override
	public List<OmsChargerChargeBillRecord> findChargeBills(OmsChargerChargeBillRecord queryObj,int pageNo){
		return this.omsChargerChargeBillRecordDao.findListByPageAndGroupAndOrderAndCondition(queryObj, "", pageNo, null, null, null,null);
	}
	@Override
	public List<Map<String, Object>> findMapDatabySql(String sql) {
		return this.omsChargerChargeBillRecordDao.findDataBySql(sql, null);
	}
	
	/********************20160408 perlin add begin*******************************/
	@Override
	public List<OmsChargerChargeBillRecord> findChargeBillsWithCondition(
			OmsChargerChargeBillRecord queryChargeBill, String conditionSql,
			int pageNo) {
		return this.omsChargerChargeBillRecordDao.findListByPageAndGroupAndOrderAndCondition(queryChargeBill, conditionSql, pageNo, null, "start_time", 2, null);
	}
	/********************20160408 perlin add end*******************************/
	

}
